function tagCounter(tagName)
{
    var a = document.getElementsByTagName(tagName.toString());

    return a.length;
}

console.log(tagCounter('div'));